﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Diagnostics;

namespace Jet.Dal.EF.Tests.DataObjects
{
	/// <summary>
	/// Information about orders from Northwind database
	/// </summary>
	[DebuggerDisplay("{OrderID}")]
	[Table("Orders")]
	public class Order
	{
		[Key]
		public int OrderID { get; set; }

		[Column]
		public int? EmployeeID { get; set; }

		[Column]
		public string CustomerID { get; set; }

		[Column]
		public int? ShipVia { get; set; }

		[Column]
		public DateTime? OrderDate { get; set; }

		[Column]
		public DateTime? RequiredDate { get; set; }

		[Column]
		public DateTime? ShippedDate { get; set; }

		[Column]
		public decimal Freight { get; set; }

		[Column]
		public string ShipName { get; set; }

		[Column]
		public string ShipAddress { get; set; }

		[Column]
		public string ShipCity { get; set; }

		[Column]
		public string ShipRegion { get; set; }

		[Column]
		public string ShipPostalCode { get; set; }

		[Column]
		public string ShipCountry { get; set; }

		[ForeignKey("CustomerID")]
		public virtual Customer Customer { get; set; }

		[ForeignKey("EmployeeID")]
		public virtual Employee Employee { get; set; }

		[ForeignKey("ShipVia")]
		public virtual Shipper Shipper { get; set; }

		public virtual ICollection<OrderDetails> Details { get; set; }

		/// <summary>
		/// Returns information about order
		/// </summary>
		public override string ToString()
		{
			return String.Format("ID:'{0}' CustomerID:'{1}', EmployeeID:'{2}'", OrderID, CustomerID, EmployeeID);
		}
	}
}
